var a = "jiangxi"
let b = "jiujiang"

var a1 = 1
let a2 = 2

var flag1 = true
let flag2 = false

// 定义空对象
var obj1 = {}
let obj2= {}

// 空对象
var obj3 = new Object()
let obj4 = new Object()

obj4.username = "apple"
obj4.gender = "female"
obj4.price = 88.8
console.log(obj4);



// 给空对象增加属性

var student = {
    username:"zhangsan",
    password:"123456",
    gender:"male",
    age:"18",
    flag:true,
}

console.log(student.username)
console.log(student.password);

//给对象增加地址属性
student.address = "jx jiujiang"
console.log(student.address);
 


// 普通函数

function adcPerson(params) {
    
}


function calc(a,b) {
    console.log(a + b);
    
}


// 函数调用

// calc(3,7)

function printlog(a,b,c=3) {
    console.log(a+b+c);
}

printlog(1,2,4)


function getNumber() {
    return 2;
}

console.log(getNumber());

function getsum(a,b) {
    return a + b
}

var personInfor = {
    username:"zhangsan",
    age:19,
    score : [80,85,99]
}

function getScore_sum(p) {
    let sum = 0
    for (let index = 0; index < p.score.length; index++) {      
        sum += p.score[index]
    }
    return sum
}

console.log(getScore_sum(personInfor));


var fruitObj = {
    fruitName:"赣南脐橙",
    fruitPrice:299,
    fruitColor:["red","blue","yellow"],
    price:function getPrice() {
        return this.fruitPrice
    },
    colorCount:function getColorCount() {
        console.log(this.fruitColor.length);
        
        // return this.fruitColor.length
    }
}

fruitObj.colorCount()

function getInform() {
    
}

let fruit01 = function () {
    return 2 + 2
}

// 箭头函数
let fruit2 = () => {
    return 2+2;
}
console.log(fruit2());


let fruit = (a) => {
    console.log(a);
}

fruit(8888888888888888888)

let fruit4 = (byd) => {
    byd()
}

fruit4(function () {
    console.log("this is byd!!!");
})